﻿using System;
using System.Collections.Generic;
using System.Web;
using DAO;

namespace BUS
{
    public class ThongTinTaiKhoanBUS
    {
        private ThongTinTaiKhoanDAO _dDAO;

        public ThongTinTaiKhoanBUS()
        {
            _dDAO = new ThongTinTaiKhoanDAO();
        }
        public THONGTINTAIKHOAN ChiTietname(String name)
        {
            return _dDAO.Layusername(name);
        } 
        public bool Them(THONGTINTAIKHOAN _THONGTINTAIKHOAN)
        {
            return _dDAO.Them(_THONGTINTAIKHOAN);
        }
        public bool Xoa(THONGTINTAIKHOAN _THONGTINTAIKHOAN)
        {
            return _dDAO.Xoa(_THONGTINTAIKHOAN);
        }
        public bool Sua(THONGTINTAIKHOAN _THONGTINTAIKHOAN)
        {
            return _dDAO.Sua(_THONGTINTAIKHOAN);
        }
        public bool KTname(String name)
        {
            return _dDAO.KiemTraName(name);
        } 
        public THONGTINTAIKHOAN ChiTiet(String _id)
        {
            return _dDAO.LayID(_id);
        }
        public List<THONGTINTAIKHOAN> LietKe()
        {
            return _dDAO.LietKe();
        }

        public THONGTINTAIKHOAN KiemTraDangNhap(string name, string password)
        {
            if (name == "" || password == "")
                return null;

            THONGTINTAIKHOAN t = _dDAO.TimTenDangNhap(name);
            if (t != null)
            {
                if (password == t.MATKHAU)
                {
                    return t;
                }
            }
            return null;
        }
    }
}